<!doctype html><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<script src="https://cdn.bootcss.com/d3/3.5.17/d3.min.js"></script>
<title>d3比例尺</title>
</head>
<body>
    <p></p>
    <p></p>
    <script>
       var dataset = [1,2,3,4];
       var width = 600;
       var height = 100;
       var svg = d3.select('body').append('svg')
       .attr('width', width)
       .attr('height', height);
       var update = d3.select('body').selectAll('p').data(dataset);
       update.text(function (d,i){
           return 'update ' + d;
       });
       update.enter().append('p').text(function(d, i){
           return 'enter ' + d;
       });
    </script>
</body>
</html>
